# Importing Data
UAE<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "AH1:AH264")

# Checking the Imported Data
View(UAE)
# Creating Time Series Data
UAE_ts <- ts(UAE, start=c(1998,1), end=c(2018,12), frequency=12)
# Viewing and Checking the Created Time Series Data
UAE_ts
sum(is.na(UAE_ts))
library(forecast)
UAE_ts <- tsclean(UAE_ts)
UAE_ts

# Identification: Plotting the Time Series Data
plot(UAE_ts)

# Estimating the appropriate model
UAE_ts_model <- auto.arima(UAE_ts)
UAE_ts_model

# Forecasting
options(max.print=1000000)
UAE_ts_forecast <- forecast (UAE_ts_model, level=c(95), h=364)
plot(UAE_ts_forecast)
UAE_ts_forecast             

# Exporting
write.table(UAE_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/UAE_TSA.csv", sep=",")
